package sindconsole;

import common.mybatis.EnableMybatis;
import common.shiro.EnableShiro;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.oas.annotations.EnableOpenApi;

@Slf4j
@SpringBootApplication
@EnableCaching
@EnableMybatis
@EnableShiro
@EnableOpenApi
@EnableScheduling
public class Main {

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(Main.class, args);
        Environment env = application.getEnvironment();
        String address = env.getProperty("server.address", "localhost");
        String port = env.getProperty("server.port");
        String contextPath = env.getProperty("server.servlet.context-path", "");
        log.info("\n----------------------------------------------------------\n\t" +
                "启动成功:\n\t" +
                "访问网址: \thttp://" + address + ":" + port + contextPath + "\n\t" +
                "Swagger: \thttp://" + address + ":" + port + contextPath + "/swagger-ui/\n\t" +
                "----------------------------------------------------------");
    }

}
